package ru.niir.goodfil.db.audit.helpers;

import ru.niir.goodfil.audit.domain.Event;

/**
 * @author ksazonov
 */
public class NullAuditHelper implements AuditHelper {
    public String getIp() {
        return "[ip]";
    }

    public String getLogin() {
        return "[login]";
    }

    @Override
    public <T extends Event> T createEvent(Class<? extends Event> klass) {
        try {
            Event event = klass.newInstance();

            event.setIp(getIp());
            event.setLogin(getLogin());

            return (T) event;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
